package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 活动状态
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum ActivityStatusEnum {

    /**
     * 1-可预约
     */
    RESERVE_ENABLE(1, "可预约"),
    /**
     * 2-活动进行中
     */
    IN_PROGRESS(2, "活动进行中"),
    /**
     * 3-活动结束或下架
     */
    OTHER(3, "活动结束");

    private final Integer code;
    private final String name;

    public static ActivityStatusEnum getNameByCode(Integer code) {
        return Arrays.stream(ActivityStatusEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
